package mvp.com.bbc.rcjavaretrofitdaggermvp.mvp.activity;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import mvp.com.bbc.rcjavaretrofitdaggermvp.R;
import mvp.com.bbc.rcjavaretrofitdaggermvp.app.utils.ToastUtlis;
import mvp.com.bbc.rcjavaretrofitdaggermvp.baseAF.BaseActivity;
import mvp.com.bbc.rcjavaretrofitdaggermvp.bean.Travel;

/**
 * Created by ${cbf} on 2017/11/28.
 */

public class InfoActivity extends BaseActivity {
    @BindView(R.id.image)
    ImageView image;
    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.cardView)
    CardView cardView;
    private static final String EXTRA_TRAVEL = "EXTRA_TRAVEL";

    @Override
    protected int setContentLayout() {
        return R.layout.activity_info;
    }

    @Override
    protected void findViews() {

    }

    @Override
    protected void init() {
        Travel travel = getIntent().getParcelableExtra(EXTRA_TRAVEL);
        if (travel != null) {
            image.setImageResource(travel.getImage());
            title.setText(travel.getName());
        }
    }

    public static Intent newInstance(Context context, Travel travel) {
        Intent intent = new Intent(context, InfoActivity.class);
        intent.putExtra(EXTRA_TRAVEL, travel);
        return intent;
    }

    @Override
    protected void setListeners() {
        cardView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ToastUtlis.ToastShow(InfoActivity.this, "dianjia");
            }
        });

    }

    @Override
    public void onClick(View view) {

    }

}
